package unitTest;

import test.SayHello;
import j2meunit.framework.Test; 
import j2meunit.framework.TestCase;
import j2meunit.framework.TestMethod;
import j2meunit.framework.TestSuite;

public class TestSayHello extends TestCase {
	private SayHello hello;
	private String[] testCases;
	public TestSayHello() {
		testCases = new String[] {"testSay", "testSayAgain"};
	}
	
	protected void setUp() throws Exception {
		super.setUp();
		hello = new SayHello();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	/**
	 * Override to run the test and assert its state.
	 * @exception Throwable if any exception is thrown
	 */
	protected void runTest() throws java.lang.Throwable {
		if (getName().equals("testSay"))
			testSay();
		else if (getName().equals("testSayAgain"))
			testSayAgain();
	}
	
	public Test suite() {
		return new TestSuite(new TestSayHello().getClass(),testCases);
	}

	public void testSay() {
		String s = hello.say();
		assertEquals("Hello", s);
	}
	public void testSayAgain() {
		String s = hello.sayAgain();
		assertEquals("Hello Again", s);
	}
}




